{
  "properties" : { },
  "id" : "copy1735191977253d11090",
  "script" : null,
  "groupId" : "1d212495794d4254ab8b5e9f1e9dfc68",
  "name" : "clazz使用",
  "createTime" : null,
  "updateTime" : 1735198404457,
  "lock" : null,
  "createBy" : null,
  "updateBy" : null,
  "path" : "/http003",
  "method" : "POST",
  "parameters" : [ ],
  "options" : [ ],
  "requestBody" : "",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : "{\n    \"ok\": \"169.254.139.129\"\n}",
  "description" : null,
  "requestBodyDefinition" : null,
  "responseBodyDefinition" : {
    "name" : "",
    "value" : "",
    "description" : "",
    "required" : false,
    "dataType" : "Object",
    "type" : null,
    "defaultValue" : null,
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ {
      "name" : "ok",
      "value" : "169.254.139.129",
      "description" : "",
      "required" : false,
      "dataType" : "String",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    } ]
  }
}
================================
import http;
import request;
import response;
import log;
import 'java.util.HashMap' as HashMap;
import 'java.util.Map' as Map;

var header = request.getHeaders("Host");
var clientIp = request.getClientIP();
var headxxx = request.getHeaders('xxx');

// get请求
// 相关文档： https://www.ssssssss.org/magic-api/pages/module/http/
var tt = http.connect('http://127.0.0.1:29410/hello/1').contentType('application/json').param("clientid",clientIp).get().getBody();
log.info('返回的结果：{}', tt);



// 携带header的post请求
Map params = new HashMap();
params.put("Authorization", "Basic YWRtaW46YWRtaW5AMTIzNA==");
var xx = http.connect('http://127.0.0.1:29410/hello/stu').body({
    "id": '111', //传入参数 
    "name": 'liu'
}).param("id", 1234).header(params).post().getBody();

log.info('message--> {}', xx);

// 构建Json结果，结果不会经过框架包装处理。
return response.json({
    ok: clientIp
})
//直接返回该text，不会被包装处理
// return response.text(tt);